package com.newsmanagement.enums;

/**
 * 节点企业类型枚举
 */
/**
 * 节点企业类型枚举
 */
public enum EntTypeEnum {

    BREEDING_ENT(1, "养殖企业"),
    SLAUGHTERING_ENT(2, "屠宰企业"),
    FARMING_ENT(3, "批发商"),
    MARKET_ENT(4, "零售商");

    private final int value;
    private final String desc;

    EntTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据值获取对应的枚举类型
     * @param value 枚举值
     * @return 对应的枚举类型，未找到返回null
     */
    public static EntTypeEnum fromValue(int value) {
        for (EntTypeEnum type : EntTypeEnum.values()) {
            if (type.value == value) {
                return type;
            }
        }
        return null;
    }
}